import http from '../api/httpRequest.js'

export default {
	state: {
		webrtc: {},
		shareProduct: {},
		shareUser:{}
	},
	mutations: {
		setConfig(state, config) {
			state.webrtc = config;
		},
		clear(state) {
			state.webrtc = {};
		},
		setShareUser(state, config) {
			state.shareUser = config;
		},
		clearShareUser(state) {
			state.shareUser = {};
		},
		setShareProduct(state, config) {
			state.shareProduct = config;
		},
		clearShareProduct(state) {
			state.shareProduct = {};
		}
	},
	actions: {
		loadConfig(context) {
			return new Promise((resolve, reject) => {
				http({
					url: '/im/system/config',
					method: 'GET'
				}).then((config) => {
					// console.log("系统配置", config[0])
					context.commit("setConfig", config[0]);
					resolve();
				}).catch((res) => {
					reject(res);
				});
			})
		},
	}

}